﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/VS/Colors.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <Style TargetType="TextBox"
           x:Key="StandardTextBox">
        <Setter Property="Background"
                Value="{StaticResource TextBoxBackground}" />
        <Setter Property="Foreground"
                Value="{StaticResource Foreground}" />
        <Setter Property="CaretBrush"
                Value="{StaticResource Foreground}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBox}">
                    <Grid Background="{TemplateBinding Background}"
                          SnapsToDevicePixels="true">
                        <ScrollViewer x:Name="PART_ContentHost"
                                      Margin="1" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver"
                                 Value="true">
                            <Setter Property="Background"
                                    Value="{StaticResource TextBoxBackgroundSelected}" />
                        </Trigger>
                        <Trigger Property="IsFocused"
                                 Value="true">
                            <Setter Property="Background"
                                    Value="{StaticResource TextBoxBackgroundSelected}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="TextBox"
           x:Key="SearchTextBox">
        <Setter Property="Background"
                Value="{StaticResource TextBoxBackground}" />
        <Setter Property="Foreground"
                Value="{StaticResource Foreground}" />
        <Setter Property="CaretBrush"
                Value="{StaticResource Foreground}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBox}">
                    <Grid Background="{TemplateBinding Background}"
                          SnapsToDevicePixels="true">
                        <TextBlock Foreground="{StaticResource SearchTextForeground}"
                                   Margin="5,0,0,0"
                                   VerticalAlignment="Center"
                                   Name="search"
                                   Text="Search ..."
                                   Visibility="Hidden" />
                        <ScrollViewer x:Name="PART_ContentHost"
                                      Margin="1" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="TextBox.Text"
                                 Value="">
                            <Setter TargetName="search"
                                    Property="Visibility"
                                    Value="Visible" />
                        </Trigger>
                        <Trigger Property="TextBox.Text"
                                 Value="{x:Null}">
                            <Setter TargetName="search"
                                    Property="Visibility"
                                    Value="Visible" />
                        </Trigger>
                        <Trigger Property="IsMouseOver"
                                 Value="true">
                            <Setter Property="Background"
                                    Value="{StaticResource TextBoxBackgroundSelected}" />
                            <Setter TargetName="search"
                                    Property="Foreground"
                                    Value="{StaticResource Foreground}" />
                        </Trigger>
                        <Trigger Property="IsFocused"
                                 Value="true">
                            <Setter Property="Background"
                                    Value="{StaticResource TextBoxBackgroundSelected}" />
                            <Setter TargetName="search"
                                    Property="Visibility"
                                    Value="Hidden" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>